package gms.smap;

import gms.topology.Topology;
import gms.topology.Line;

import java.util.Enumeration;

/**
 * Created by IntelliJ IDEA.
 * User: Anton Dunaev
 * Date: 18.09.2007
 * Time: 14:24:04
 */
public class SimpleSMapGenerator
{
    static public SendMap getSMap( Topology topology )
    {
        SendMap smap = new SendMap();
        Enumeration<Long> line_ids_enum = topology.lines.keys();
        while( line_ids_enum.hasMoreElements() )
        {
            Long[] id = new Long[1];
            id[0] = line_ids_enum.nextElement();
            Line line = topology.lines.get( id[0] );
            smap.setPath( line.getNode_1(), line.getNode_2(), id );
            smap.setPath( line.getNode_2(), line.getNode_1(), id );
        }
        return smap;
    }
}
